//=============================================================================
// MK23 Pickup.
//=============================================================================
class MK23WPickup extends SRKFWeaponPickup;

function bool CheckCanCarry(KFHumanPawn Hm)
{
	local Inventory CurInv;
	local bool bHasMK23;

	for ( CurInv = Hm.Inventory; CurInv != none; CurInv = CurInv.Inventory )
	{
		if ( KFWeapon(CurInv) != none && CurInv.class.Name == 'MK23W' )
		{
			bHasMK23 = true;
		}
	}

	if (	!Hm.CanCarry(Class<KFWeapon>(InventoryType).Default.Weight) && 
			InventoryType.Name != 'MK23W')
	{
		if ( LastCantCarryTime < Level.TimeSeconds && PlayerController(Hm.Controller) != none )
		{
			LastCantCarryTime = Level.TimeSeconds + 0.5;
			PlayerController(Hm.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 2);
		}
		return false;
	}

	if ( InventoryType.Name == 'MK23W' )
	{
		if ( !bHasMK23 && !Hm.CanCarry(Class<KFWeapon>(InventoryType).Default.Weight) )
		{
			LastCantCarryTime = Level.TimeSeconds + 0.5;
			PlayerController(Hm.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 2);
			return false;
		}
	}
	return true;
}

function Inventory SpawnCopy( pawn Other )
{
	local Inventory I;

	for( I=Other.Inventory; I!=None; I=I.Inventory )
	{
		if( MK23W(I)!=None )
		{
			if( Inventory!=None )
				Inventory.Destroy();
			InventoryType = class'DualMK23W';
			I.Destroyed();
			I.Destroy();
			return Super.SpawnCopy(Other);
		}
	}
	InventoryType = Default.InventoryType;
	return Super.SpawnCopy(Other);
}

defaultproperties
{
     Weight=2.000000
     cost=500
     AmmoCost=16
     BuyClipSize=12
     PowerValue=50
     SpeedValue=45
     RangeValue=60
     Description="45 Cal ACP handgun. A powerful personal choice for personal defense."
     ItemName="Old MK23"
     ItemShortName="Old MK23"
     AmmoItemName=".45 ACP Ammo"
     showMesh=SkeletalMesh'KFWeaponPackAnims.Mk23-3rd'
     CorrespondingPerkIndex=2
     EquipmentCategoryID=1
     InventoryType=Class'PerksSimHostOrg.MK23W'
     PickupMessage="You got the MK.23"
     PickupSound=Sound'KF_HandcannonSnd.50AE_Pickup'
     PickupForce="AssaultRiflePickup"
     StaticMesh=StaticMesh'KFWeaponPackStatics.MK23Pickup'
     DrawScale=1.500000
     CollisionHeight=5.000000
}
